1

00:00:00,389  -->  00:00:08,298
In the previous video, we already do nested
looping, so we have looping inside looping,

2

00:00:09,039  -->  00:00:17,447
the first looping is to looping on all router,
and then for each router, we do looping to

3

00:00:17,447  -->  00:00:20,420
configure multiple loopback interface.

4

00:00:21,418  -->  00:00:25,468
But this script actually is not best practice.

5

00:00:26,446  -->  00:00:35,740
For now, the ip address of all router is similar,
the first 3 number is same, and the last number

6

00:00:35,740  -->  00:00:37,530
is in sequence.

7

00:00:38,375  -->  00:00:44,249
The problem is, if the ip address of all router
is totally different.

8

00:00:44,886  -->  00:00:47,750
So we can not looping like this.

9

00:00:48,785  -->  00:00:56,544
The best way to configure multiple router
at once is using a list, so we save the ip

10

00:00:56,544  -->  00:01:03,000
address of all router in the list, and then
we can do looping to the list.

11

00:01:03,940  -->  00:01:07,730
Let’s just try it, copy this script.

12

00:01:08,404  -->  00:01:16,026
Create new file, let’s say the name is netmiko_looping_list.py.

13

00:01:18,572  -->  00:01:20,057
Paste the script.

14

00:01:21,150  -->  00:01:26,114
Now let’s create the list to save the ip
address of all router,

15

00:01:27,074  -->  00:01:42,550
List_ip, and then let’s define the ip address
of all router, 10.10.10.1, 10.10.10.2, 10.10.10.3,

16

00:01:43,348  -->  00:01:46,597
this is to long, so we can enter here.

17

00:01:52,600  -->  00:01:59,336
And then 10.10.10.4, and last 10.10.10.5.

18

00:02:00,466  -->  00:02:08,108
Now we can do looping in the list, let’s
say for ip in list_ip,

19

00:02:12,514  -->  00:02:16,591
For the host, we can just use the ip variable.

20

00:02:22,423  -->  00:02:30,053
Here we will connect to each router, let’s
just remove the list config, so we will not

21

00:02:30,053  -->  00:02:35,364
configure anything, we will just only show
the interface.

22

00:02:40,711  -->  00:02:50,821
Okay we have done here, save, back to the
ubuntu server, ls, here we can see that we

23

00:02:50,821  -->  00:02:56,168
have netmiko_looping_list.py, let’s execute
this.

24

00:03:03,325  -->  00:03:16,828
Router 1 success, router 2 success, rotuer 3
success, router 4 success, and router 5 is also succes.

25

00:03:17,740  -->  00:03:22,792
So now we are success to remote multiple router
at once using list.

26

00:03:23,666  -->  00:03:25,953
I think enough for this video

27

00:03:26,361  -->  00:03:29,920
Thank you for watching and see you on the next video.
